|
|
 |
|
|
|
|
y2 = CurvePoints(j).trans(2)
z2 = CurvePoints(j).trans(3)
m3ApplyFull _
CurvePoints(j).coord, trans(i).M, _
CurvePoints(j) .trans
x3 = CurvePoints(j).trans(1)
y3 = CurvePoints(j).trans(2)
z3 = CurvePoints(j).trans(3)
solid.AddFace _
x0, y0, z0, _
x2, y2, z2, _
x1, y1, z1
solid.AddFace _
x2, y2, z2, _
x3, y3, z3, _
x1, y1, z1
x0 = x2
y0 = y2
z0 = z2
x1 = x3
y1 = y3
z1 = z3
Next j
Next i
' Add the final curve to solid assuming
' the curve is stored oriented towards the
' transformations. If cap_ends Then
Set face = New Face3d
solid.Faces.Add face
For i = 2 To NumCurvePts
face.AddPoints _
CurvePoints(i).trans(1), _
CurvePoints(i).trans(2), _
CurvePoints(i).trans(3)
Next i
End If
End Sub |
|
|
|
|
|
|
|
|
This code uses two polygons to close the surface to form a solid. Other surfaces, like fractal terrains and Bezier surfaces, are generally not closed solids. The Depth-Sort algorithm works with these open surfaces, but backface removal does not. No matter how you orient the triangles, there will be places you can put the center of projection so that backface removal eliminates triangles that should be displayed. This produces holes in the surface. |
|
|
|
|
|
|
|
|
For some well-behaved surfaces, you can restrict the allowed positions of the center of projection and still use hidden surface removal. If the surface is mostly flat, like a fractal |
|
|
|
|
|